package mod.luckymod;

import com.simibubi.create.Create;
import com.simibubi.create.foundation.data.CreateEntityBuilder;
import com.tterrag.registrate.util.entry.EntityEntry;
import com.tterrag.registrate.util.nullness.NonNullFunction;
import com.tterrag.registrate.util.nullness.NonNullSupplier;
import mod.luckymod.entity.SodiumEntity;
import net.createmod.catnip.lang.Lang;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;

public class ModEntities {
    private static <T extends Entity> CreateEntityBuilder<T, ?> register(String name, EntityType.EntityFactory<T> factory,
                                                                         NonNullSupplier<NonNullFunction<EntityRendererProvider.Context, EntityRenderer<? super T>>> renderer,
                                                                         MobCategory group, int range, int updateFrequency, float height,float width) {
        String id = Lang.asId(name);
        return (CreateEntityBuilder<T, ?>) Luckymod.registrate()
                .entity(id, factory, group)
                .properties(b -> b.setTrackingRange(range)
                        .setUpdateInterval(updateFrequency))
                .properties(b -> {
                    b.sized(width,height);
                })
                .renderer(renderer);
    }
    public static final EntityEntry<SodiumEntity> SodiumEntity = register("SodiumEntity",
            SodiumEntity::new, () -> SodiumEntityRenderer::new,MobCategory.MISC,4,20,0.25f,0.25f)
            .register();
    public static void register() {
    }
}